package com.hmall.api.item;


import com.hmall.api.item.dto.ItemDTO;
import com.hmall.api.item.dto.OrderDetailDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;
import java.util.List;

/**
 * @author ljc
 * @version V1.0
 * @date 2025-03-15 17:22
 */
@FeignClient(name = "item-service", path = "/items")
public interface ItemClient {
    /**
     *  根据id查询商品信息
     * @param ids
     * @return
     */
    @GetMapping
    List<ItemDTO> queryItemByIds(@RequestParam("ids") Collection<Long> ids);

    /**
     *  扣减库存
     * @param items
     */
    @PutMapping("/stock/deduct")
    void deductStock(@RequestBody List<OrderDetailDTO> items);
    /**
     * 恢复库存
     */
    @PutMapping("/stock/recovery")
    void recoveryStock(@RequestParam("itemId") Long itemId, @RequestParam("num") Integer num);
}
